package primeiro.jogoandroid;

public class Retangulo {
	private int x;
	private int y;
	private int width;
	private int heigth;
	
	public Retangulo(int x, int y, int width, int heigth) {
		super();
		this.x = x;
		this.y = y;
		this.width = width;
		this.heigth = heigth;
	}
	
	public boolean colide(Retangulo r){
		if (r.getX()> x+width) {
			return false;
		}
		if (r.getY()> y+heigth) {
			return false;
		}
		if (r.getX()+r.getWidth()<x) {
			return false;
		}
		if (r.getY()+r.getWidth()<y) {
			return false;
		}
		return true;
	}
	
	public boolean colide(int x2, int y2){
		if(x2>x+width) return false;
		if(y2>y+heigth) return false;
		if(x2<x) return false;
		if(y2<y) return false;
		
		return true;
	}
	
	
	public int getX() {
		return x;
	}
	public void setX(int x) {
		this.x = x;
	}
	public int getY() {
		return y;
	}
	public void setY(int y) {
		this.y = y;
	}
	public int getWidth() {
		return width;
	}
	public void setWidth(int width) {
		this.width = width;
	}
	public int getHeigth() {
		return heigth;
	}
	public void setHeigth(int heigth) {
		this.heigth = heigth;
	}
	
}
